package security.crypto;

import javax.crypto.SecretKey;

import data.model.Data;

public class DummyXorCipher implements Cipher {
	private byte[] key = "prout! Beeeh ca pue!".getBytes();

	@Override
	public Data decrypt(Data data,SecretKey trucinutile) {
		byte[] tmp = data.getData();
		for(int i = 0; i<tmp.length; i++)
			tmp[i] = (byte)(tmp[i] ^ key[i % key.length]);
		return new Data(tmp);
	}

	@Override
	public Data encrypt(Data data,SecretKey trucinutile ) {
		byte[] tmp = data.getData();
		for(int i = 0; i<tmp.length; i++)
			tmp[i] = (byte)(tmp[i] ^ key[i % key.length]);
		return new Data(tmp);
	}
	
	
}
